﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ADL;

namespace CDIO.Controllers
{
    public class GiftActionController : Controller
    {
        //
        // GET: /GiftAction/

        /// <summary>
        /// 礼品删除
        /// </summary>
        /// <param name="giftid"></param>
        /// <returns></returns>
        public ActionResult Gift_Delete(string _gift_id)
        {
            ADL_gift ad_us = new ADL_gift();
            _gift us = new _gift();
            us._gift_id = _gift_id;
            if (ad_us.delete(us))
            {
                return Json(new { Result = true, Message = "删除成功" });
            }
            return Json(new { Result = true, Message = "删除失败" }); ;
        }

        public ActionResult Gift_Add(string _gift_id, string _gift_type, string _gift_name, string _gift_credit, string _gift_src, string _gift_account, string _gift_state, string _gift_rangetime, string _gift_sorttime, string _gift_descript)
        {
            ADL_gift ad_us = new ADL_gift();
            _gift us = new _gift();
            us._gift_id = _gift_id;
            us._gift_type = _gift_type;
            us._gift_name = _gift_name;
            us._gift_credit = _gift_credit;
            us._gift_src = _gift_src;
            us._gift_account = _gift_account;
            us._gift_state = _gift_state;
            us._gift_rangetime = _gift_rangetime;
            us._gift_sorttime = _gift_sorttime;
            us._gift_descript = _gift_descript;
            if (ad_us.insert(us) != null)
            {
                return Json(new { Result = true, Message = "添加成功" });
            }
            return Json(new { Result = true, Message = "添加失败" });
        }

        public ActionResult Gift_Change(string _gift_id, string _gift_type, string _gift_name, string _gift_credit, string _gift_src, string _gift_account, string _gift_state, string _gift_rangetime, string _gift_sorttime, string _gift_descript)
        {
            ADL_gift ad_us = new ADL_gift();
            _gift us = new _gift();
            us._gift_id = _gift_id;
            us._gift_type = _gift_type;
            us._gift_name = _gift_name;
            us._gift_credit = _gift_credit;
            us._gift_src = _gift_src;
            us._gift_account = _gift_account;
            us._gift_state = _gift_state;
            us._gift_rangetime = _gift_rangetime;
            us._gift_sorttime = _gift_sorttime;
            us._gift_descript = _gift_descript;
            if (ad_us.update(us))
            {
                return Json(new { Result = true, Message = "修改成功" });
            }
            return Json(new { Result = true, Message = "修改失败" });
        }

    }
}
